package com.qianheng.kit.base.dto;

import lombok.Getter;

public class LogDTO {
    public static final int LOG_MAX_SIZE = 10000;

    @Getter
    private StringBuilder logsb = new StringBuilder();
    private boolean logIsMax = false;

    public void appendLog(String message) {
        if (logIsMax) {
            return;
        }
        logsb.append(message).append(";");
        if (logsb.length() > LOG_MAX_SIZE) {
            logsb.replace(LOG_MAX_SIZE - 3, logsb.length(), "...");
            logIsMax = true;
        }
    }
}
